package com.zhdl.modules.patrolinspection;

import com.zhdl.common.util.WebResult;
import com.zhdl.network.asclltcp.AsciiSendService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping(path = "/robotPatrol", produces = MediaType.APPLICATION_JSON_VALUE)

public class PatrolInspectionController {

    @Resource
    private AsciiSendService asciiSendService;

    @GetMapping("/run")
    public WebResult<String> manualPutDownCage(int id) {
        if (id == 1) {
            /* 原点 */
//            asciiSendService.sendLocationOrigin();
            /* 指令3 */
            asciiSendService.sendLocationMove3();
        } else if (id == 2) {
            /* 指令1 */
            asciiSendService.sendLocationMove1();
        } else if (id == 3) {
            /* 指令2 */
            asciiSendService.sendLocationMove2();
        }
        return WebResult.okResult("patrol robot Run Success!");
    }
}
